/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package view.panels.graphical.drawables;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import jgf.beans.NodeBean;

/**
 * 
 * @author Marcos Garcia Ortega <a href="mailto:thiamath@gmail.com">&lt;thiamath@gmail.com&gt;</a>
 */
public class DrawSourceNode extends DrawNode{

	//protected Color background = Color.GREEN;

	public DrawSourceNode(NodeBean node, Point coords) {
		super(node, coords);
	}

	public DrawSourceNode(DrawNode node){
		this.background = node.background;
		this.foreground = node.foreground;
		this.index = node.index;
		this.linked = node.linked;
		this.selected = node.selected;
		this.shape = node.shape;
		this.tag = node.tag;
	}

	@Override
	public void display(Graphics2D g) {

		Rectangle r = this.shape.getBounds();
		this.shape.setFrame(shape.x-2, shape.y-2, shape.width+4, shape.height+4);
		g.setColor(Color.GREEN);
		g.fill(shape);
		this.shape.setFrame(r);

		super.display(g);
	}

	public DrawNode toDrawNode(){
		DrawNode ret = new DrawNode();

		ret.background = this.background;
		ret.foreground = this.foreground;
		ret.index = this.getId();
		ret.linked = this.getLinkedArcs();
		ret.selected = this.isSelected();
		ret.shape = this.getShape();
		ret.tag = this.getTag();

		return ret;
	}
}
